<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>

    <link rel="shortcut icon" href="../../images/favicon.png"/>
    <link rel="stylesheet" href="../../vendors/iconfonts/mdi/css/materialdesignicons.min.css"/>
    <link rel="stylesheet" href="../../vendors/css/vendor.bundle.base.css"/>
    <link rel="stylesheet" href="../../css/style.css"/>
    <link rel="shortcut icon" href="../../images/favicon.png"/>
    <script type="text/javascript" src="../../js/Calendar.js"></script>

    <style type="text/css">
        #menu, #ac {
            list-style: none; /* 将默认的列表符号去掉 */
            padding: 0; /* 将默认的内边距去掉 */
            margin: 0; /* 将默认的外边距去掉 */
        }

        #ac li {
            float: left; /* 往左浮动 */
        }
        #anu{
            float: right;
        }
    </style>

</head>

<body>

<div calss="card-head">
    <h6 class="card-title">首页/运营管理/消息管理/站内信消息</h6>
    <div class="card">
        <div class="card-body2">


            <div id="menu" style="margin-left:5px;">

                <form class="form-inline" id="formStation" method="post">
                    <input type="hidden" id="currentPageNo" name="currentPageNo" value="1"/>
                    <ul id="ac">
                        <li>
                            <p>帮助标题：
                                <input type="text" class="form-control mb-2 mr-sm-2" id="inlineFormInputName2"
                                name="stationMessageTitle"   th:value="${stationMessageTitle}"    placeholder="  帮助标题" style=" width:200px"/>
                            </p>
                        </li>
                        <li>

                            <p>发布人员：
                                <input list="test" type="text" class="form-control" id="inlineFormInputGroupUsername2"
                                  name="stationPublisher"  th:value="${stationPublisher}"   placeholder="  全部" style=" margin-right:10px;"/>
                                <datalist id="test">
                                    <option th:each="StationLetter:${qryStationLetterList}"
                                            th:text="${StationLetter.stationPublisher}"></option>
                                </datalist>
                            </p>
                        </li>
                        <!--<li>-->

                            <!--<p>发布时间：-->
                                <!--<input name="control_date" type="text" style="text-decoration:none; margin-right:20px;"-->
                                       <!--class="form-control" id="shijian3" readonly="readonly" placeholder="  请选择日期"-->
                                       <!--onclick="new Calendar().show(this);"/>-->
                                <!--&lt;!&ndash; </div> &ndash;&gt;-->
                            <!--</p>-->

                        <!--</li>-->
                        <li>
                            <button type="button" id="stationSubmit"
                                    style="width:80px;text-align:center;margin-top:3px;height:40px;color:white;border-radius:5px;background:pink">
                                查询
                            </button>

                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>


</div>
<div class="card-body">

    <div id="u17880" class="ax_default _默认样式">
        <div id="u17880_div" class=""></div>
        <div id="u17880_text" class="text ">
            <p style="font-size:18px;"><span
                    style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:12px;text-decoration:none;"> </span><span
                    style="font-family:'微软雅黑';font-weight:400;font-size:12px;text-decoration:none;">数据列表</span></p>
        </div>
    </div>
    <div id="anu">
        <button  id="addDeptBtn" type="button" data-toggle="modal"
                 data-target="#myModal">发布消息</button>
        <button>群发消息</button>
        <button  disabled="disabled">显示条数</button>
        <button  disabled="disabled">排序方式</button>
    </div>


    <table class="table table-info">
        <thead>
        <tr>
            <th>
                <!--<input type="checkbox" class="form-check-input" >-->
                <input type="checkbox" id="chooseAll" style=" vertical-align: middle; margin-top: -13px;margin-left: 15px;" class="form-check-input"/>
            </th>
            <th>
                编号
            </th>
            <th>
                消息标题
            </th>
            <th>
                发布时间
            </th>
            <th>
                发布人员
            </th>
            <th>
                接受对象
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>

        <tbody>
        <tr th:attr="stationId=${StationLetter.stationId}+'_row'" th:each="StationLetter:${qryStationLetterList}" class="table-warning">
            <th>
                <input type="checkbox" style=" vertical-align: middle; margin-top: -5px;margin-left: 15px;" class="form-check-input"/>
            </th>
            <th th:text="${StationLetter.stationId}"></th>
            <th th:text="${StationLetter.stationMessageTitle}"></th>
            <th th:text="${StationLetter.stationReleaseTime}"></th>
            <th th:text="${StationLetter.stationPublisher}"></th>
            <th th:text="${StationLetter.stationSendStatistics }"></th>

            <!--<th th:text="${SystemMessage.messageContents}"></th>-->
            <th>  <a href="javascript:;" class="seeBtn"  id="seeBtn"  name="seeBtn" data-toggle="modal" data-target="#showStationInfo" th:attr="stationId=${StationLetter.stationId}">查看</a>
                  <a href="javascript:;" class="delStation" th:onclick="'del(this)'" th:attr="stationId=${StationLetter.stationId}">删除</a></th>

        </tr>
        </tbody>
    </table>

    <div class="page-bar">
        <ul class="page-num-ul clearfix">
            <li>共<span th:text="${page.totalCount }"></span>条记录&nbsp;&nbsp; <span th:text="${page.pageIndex}"></span>/<span th:text="${page.totalPageCount}"></span> 页</li>
            <button th:onclick="'javascript:pageQry(document.forms[0],1)'" th:if="${page.pageIndex gt 1 }">首页</button>
            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.pageIndex - 1}+')'"  th:if="${page.pageIndex gt 1 }">上一页</button>

            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.pageIndex + 1}+')'" th:if="${page.pageIndex lt page.totalPageCount}">下一页</button>
            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.totalPageCount}+')'" th:if="${page.pageIndex lt page.totalPageCount}">最后一页</button>
            &nbsp;&nbsp;
        </ul>
        <span class="page-go-form"><label>跳转至</label>
             <input type="hidden" id="totalPageCount" th:value="${page.totalPageCount}"/>
             <input type="text" name="inputPage" id="inputPage" class="page-key"/>页
             <button type="button" class="page-btn"
                     th:onClick="'jumpPage(document.forms[0],document.getElementById(\''+inputPage+'\').value)'">GO</button>
		</span>
    </div>

    <!-- 弹出层添加列表 -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" >
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                </div>
                <h4 class="modal-title text-center" id="myModalLabel">发送站内信</h4>
                <form class="forms-sample" id="editStationFrom">
                    <input type="hidden" id="stationId" name="stationId" value="0"/>
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="stationSendObject" class="text-left">发送对象</label>
                            <input type="text" name="stationSendObject" class="form-control" id="stationSendObject"
                                   placeholder="输入用户手机号码，多个号码请用逗号隔开"/>
                        </div>
                        <div class="form-group">
                            <label for="stationMessageTitle" class="text-left">消息标题</label>
                            <input type="text" name="stationMessageTitle" class="form-control" id="stationMessageTitle"
                                   />
                        </div>
                        <div class="form-group">
                            <label for="stationTextContent" class="text-left">消息内容</label>
                            <textarea class="form-control" name="stationTextContent" id="stationTextContent"
                                      rows="4"></textarea>
                        </div>
                        <input type="hidden" id="stationPublisher" name="stationPublisher" value="admin"/>
                        <input type="hidden" id="stationSendStatistics" name="stationSendStatistics" value="2"/>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" id="editBtn" class="btn btn-primary" data-dismiss="modal">保存
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- /弹出层添加列表 -->
    <!--弹出层查看-->
    <div class="modal fade" id="showStationInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title text-center" id="seeStation">查看消息</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                </div>
                <form class="forms-sample" id="StationFrom">
                    <input  type="hidden" id="sstationId" name="stationId" />
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="stationTitle" class="text-left"></label>
                            <input type="text" name="rName" class="form-control" id="stationTitle"
                                   disabled="disabled" value="" style="margin-left: 150px;background-color:transparent;border:0;font-size: 20px;font-family:华文彩云"/>
                        </div>
                        <input type="text" name="rName" class="form-control" id="stationTime"
                               disabled="disabled" value="" style="margin-left: 110px;margin-top:-40px;background-color:transparent;border:0;font-size: 20px;font-family:华文彩云"/>
                        <div class="form-group">
                            <label for="stationContent" class="text-left"></label>
                            <textarea class="form-control" name="stationContent" id="stationContent"
                                      disabled="disabled" value="" style="background-color:transparent;border:0;font-size: 15px;font-family:华文彩云"></textarea>
                        </div>
                        <div class="team">
                            <input type="text"  disabled="disabled" value="星火贷团队" style="margin-left: 310px;background-color:transparent;border:0;font-size: 15px;font-family:华文彩云"/>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--/弹出层查看-->


    <!--分页代码-->
</div>
<script th:src="@{../../vendors/js/vendor.bundle.base.js}"></script>
<script th:src="@{../../vendors/js/vendor.bundle.addons.js}"></script>
<script th:src="@{../../js/off-canvas.js}"></script>
<script th:src="@{../../js/misc.js}"></script>
<script th:src="@{../../js/dashboard.js}"></script>
<script type="text/javascript" th:src="@{../../js/jquery-3.2.1.min.js}"></script>
<script type="text/javascript">
    //01.分页查询
    function pageQry(form, pageIndex) {
        $.ajax({
            url: "/lhuaw/getConditionPageAll?currentPageNo=" + pageIndex + "",
            type: "post",
            data: "page=1",
            success: function () {
                window.location.href = "/lhuaw/getConditionPageAll?currentPageNo="+pageIndex;
                // $("#Conframe").load("/lhuaw/getConditionPageAll?currentPageNo=" + pageIndex + "");
            },
            error: function () {
                alert("错误");
            }
        })
    }
    function jumpPage(form, jumpPageIndex) {
        //01.数字校验
        var reg = /^[1-9]\d{0,}$/;
        if (!reg.test(parseInt(jumpPageIndex))) {
            alert("请输入合法的数字");
            return;
        }
        //02.范围校验：当前页不能大于总页数
        if (jumpPageIndex > document.getElementById("totalPageCount").value) {
            alert("已经是最后一页!");
            return;
        }
        $.ajax({
            type:"post",
            url:"/lhuaw/getConditionPageAll?currentPageNo="+jumpPageIndex+"",
            data:"page=1",
            success: function(){
                window.location.href = "/lhuaw/getConditionPageAll?currentPageNo="+jumpPageIndex;
                // $("#Conframe").load("/lhuaw/getConditionPageAll?currentPageNo="+jumpPageIndex+"");
            },
            error:function () {
                alert("错误");
            }
        })
    }
    //删除
    function del(ele) {
        var $ele =$(ele);
        var stationId =$ele.attr('stationId');

        $.ajax({
            "url":'/lhuaw/delStation/'+stationId+"",
            "type":"get",
            "data":"",
            "dataType":"json",
            "success":function(data){
                alert("删除成功>>>");
                if(data.success) {
                    $("#" + stationId + "_row").remove();
                    window.location.href = "/lhuaw/getConditionPageAll?currentPageNo=1";

                    // $("#Conframe").load("/lhuaw/getConditionPageAll?currentPageNo=1");
                }else
                    alert("删除失败>>>>>>>");
            },
            "error":function(e){
                alert("ajax异常");
            }
        });
    }

    // 新增
    $("#editBtn").click(function () {
        var editStationFrom = $("#editStationFrom");
        var stationId = $("#stationId").val();
        $.ajax({
            //发送新增ajax请求
            "url": "/lhuaw/addStation?stationLetter=" + editStationFrom.serialize() ,
            "type": "post",
            "data": {
                "stationId": stationId
            },
            "dataType": "json",
            success: function (data) {
                alert(data.msg);
                window.location.href = "/lhuaw/getConditionPageAll?currentPageNo=1";
                // $("#Conframe").load("/lhuaw/getConditionPageAll?currentPageNo=1");
            },
            error: function () {
                alert("ajax异常");
            }
        })
    });
    //新增


    //查看
    $(".seeBtn").click(function () {
        var stationId= $(this).attr('stationId');
        alert(stationId);
        $.ajax({
            "url": "/lhuaw/seeStation/"+ stationId+"",
            "type": "post",
            "data":"",
            "dataType": "json",
            success: function (data) {
                var userFind = data;
                // alert(userFind);
                $("#stationTitle").val(userFind.stationMessageTitle);
                $("#stationTime").val(userFind.stationReleaseTime);
                $("#stationContent").val(userFind.stationTextContent);
            },
            error: function () {
                alert("ajax异常");
            }
        });
    });
    //查看
    //条件查询
    $("#stationSubmit").click(function () {
        $.ajax({
            type: "post",
            dataType: "text",
            url: "/lhuaw/getConditionPageAll?currentPageNo=1",
            data:$("#formStation").serialize(),
            success: function (data) {
                alert($("#formStation").serialize());
                window.location.href = "/lhuaw/getConditionPageAll?"+$("#formStation").serialize();
                // $("#Conframe").load("/lhuaw/getConditionPageAll?"+$("#formStation").serialize()+"");
            },
            error: function () {
                alert("错误");
            }
        });
    })

    //条件查询
</script>
</body>
</html>